#pragma once

class DrawableTex2D
{
public:
	DrawableTex2D();
	virtual ~DrawableTex2D();

	void Init(UINT width, UINT height, bool hasColorMap, DXGI_FORMAT colorFormat);

	ID3D10ShaderResourceView* ColorMap() const;
	ID3D10ShaderResourceView* depthMap() const;

	void SaveDepth(const tstring& file);
	void SaveColor(const tstring& file);

	void begin();
	void end();

private:
	DrawableTex2D(const DrawableTex2D &t);
	DrawableTex2D& operator= (const DrawableTex2D &t);

	void buildDepthMap();
	void buildColorMap();
private:
	UINT m_Width;
	UINT m_Height;
	DXGI_FORMAT m_ColormapFormat;

	ID3D10ShaderResourceView* m_ColorMapSRV;
	ID3D10ShaderResourceView* m_DepthMapSRV;
	ID3D10RenderTargetView* m_ColorMapRTV;
	ID3D10DepthStencilView* m_DepthMapDSV;

	D3D10_VIEWPORT m_ViewPort;
};